package com.xiweicheng.test.springboot.im.admin.entity.security;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import com.fasterxml.jackson.annotation.JsonIgnore;

import lombok.Data;

@Entity
@Table(name = "group_members")
@Data
public class GroupMember implements Serializable {

    private static final long serialVersionUID = 4120173400657896117L;

    @Id
    @GeneratedValue
    private Long id;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "group_id", nullable = false)
    @JsonIgnore
    private Group group;

    @Column(name = "username", nullable = false, length = 50)
    private String username;

    public GroupMember() {

    }

    public GroupMember(Group group, String username) {

        this.group = group;
        this.username = username;
    }

}
